package com.prince.web.config;

import com.alibaba.druid.filter.config.ConfigTools;

/**
 * Created by Administrator on 2017/6/25.
 */
public class ConfigToolsDemo {

    //上述生成的私钥
    @SuppressWarnings("unused")
	private static final String PRIVATE_KEY_STRING = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALynvHnUNO2GLpqoVoxV00ljhB+y" + 
    		"YjRJ8WKimZ1AFw5NXrVEVr74cF99uvXl/CMLyd3Wi5gvJ3XgZVwTDCCYTjIgw7h5aEGGjcAhzZ/C" + 
    		"hkgublTgSgno3ZFmOtUBhemXqx7DpqXMa86qufvSM3UPddiFp0p4yrQVSzYnYOc9X/C/AgMBAAEC" + 
    		"gYAoTmYUWWRdgxed721eWk/kFCD8bK5SoaGzAy5yzGigo6Mic1FdR9Mqc8BoHRT7n98nSFlW0GxL" + 
    		"4P+G5oLmy+OYr+yxCzxwFOZMNONS+fgh8NkX1W/WYWFY09Ki6+N27PdcnqhxvXGk3N6h4O0evvLi" + 
    		"+CmzNiSTeonv9qtbQRlo4QJBAO88I7uydsZYk5cE0w9qwu5fzioh7qnK37139oGkdsoAb13ugYFx" + 
    		"3ONA2IfblLtCt6+C6hS1+bQygen/BeSfyCkCQQDJ4DMlrWTtEUhGMdtWy0vADl4TqZc4WY40huxr" + 
    		"8ezHxjohEKlJRNztVBUluOR1qh2+6Qp/8sPUXSWVe5ZzZS6nAkEAw09V3ObWERg/ZguKRAvlGLce" + 
    		"mUcakYQPJZ/KoAyk7kVspkMRd5x9uQo3vLKHulm9nIxEjqQCOBsD9QU+ymeoAQJAUc63K2eO5LsC" + 
    		"LN/7YLrVoaiw2wr4qu8vv32FxWCucW6VE90qnPR5Cvvt7fF1M3GSyFCr3pnEXgS5PFBu8ahpNQJB" + 
    		"AMz5toN1TXZ8suTahdy1et+ZrL1hrWplOzzmhCG7i/KPJb+Tc85R3WnSaQg+LcGgPlkuYCCQUiaY" + 
    		"7MNf5LxuKRA=";

  private static final String PUBLIC_KEY_STRING ="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8p7x51DTthi6aqFaMVdNJY4Qf" +
				  "smI0SfFiopmdQBcOTV61RFa++HBffbr15fwjC8nd1ouYLyd14GVcEwwgmE4yIMO4" +
				  "eWhBho3AIc2fwoZILm5U4EoJ6N2RZjrVAYXpl6sew6alzGvOqrn70jN1D3XYhadK" +
				  "eMq0FUs2J2DnPV/wvwIDAQAB";

    public static void main(String[] args) {
    	String plainText = "123456";
        try {
			//加密
			System.out.println(ConfigTools.encrypt(PRIVATE_KEY_STRING, plainText));
			String str = "WRPyQ0R3LPzMeLA7M0vUeHdzQEx2XZ53c5AZQPs1TvaIsqZ3KvaCjNuXVHKif4Cz/p24qybgPGuEFYVum8HI1m365aKHQRmSiYRSNf3X4Ad1o4zz/ppiqWh00RQ35izgOh6e/5VfpWaGJn9Se7reV6n3DBc8/KRDdRSJNqZ+qMg=";
			//解密
			String decrypt = ConfigTools.decrypt(PUBLIC_KEY_STRING, str);
			System.out.println(decrypt);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


}